#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort> // 串口类
#include <QSerialPortInfo> // 串口信息类
#include <QChart>   //图表类
#include <QChartView>//图表视图类 用于显示图表

#include <QValueAxis>//坐标轴
#include <QSplineSeries>//曲线
#include <QLineSeries>//折线
QT_CHARTS_USE_NAMESPACE //using namespace QT_CHARTS_NAMESPACE;
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void chart_display();
    QTimer* Timer;
    QChart* ALS_CHART =NULL;  // 仅初始化一次
    QValueAxis *ALS_X = NULL;
    QValueAxis *ALS_Y = NULL;
    QLineSeries *lineSeries = NULL;


private:
    Ui::MainWindow *ui;
    QSerialPort *serialPort;



private slots:
    void readData();
     void on_pushButton_clicked(bool checked);
     void Timer_func();


};

 void* tim_thread(void* arg);


#endif // MAINWINDOW_H
